<template>
    <button @click="show = !show">显示/隐藏</button>
    <Transition name="fade" class="dv">
        <div v-if="show">Hello,Vue3</div>
    </Transition>
</template>
<script setup>
import { ref, Transition } from 'vue';
let show = ref(false);

</script>
<style scoped>
.dv {
    margin-top: 20px;
    padding: 30px;
    background-color: blanchedalmond;
    color: mediumblue;
}
.fade-enter-active,
.fade-leave-active {
    transition: opacity 5s ease;
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}
</style>